import Dialog from './Dialog.vue'

export default {
  install(Vue) {
    Vue.prototype.$dialog = {
      show(options) {
        return new Promise((resolve) => {
          const Constructor = Vue.extend(Dialog)
          const instance = new Constructor({
            propsData: options
          })
          instance.$mount()
          document.body.appendChild(instance.$el)
        })
      }
    }
  }
}